﻿<%@ Page Language="C#" AutoEventWireup="true" EnableViewState="false" CodeBehind="Default.aspx.cs"
    Inherits="Forum.Web.Admin.KeyWord.Default" %>

<%@ Register Assembly="Public.Control" Namespace="Public.Control" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link href="../styles/dntmanager.css" rel="stylesheet" type="text/css" />
    <link href="../styles/page2.css" rel="stylesheet" type="text/css" />
    <link href="../styles/modelpopup.css" rel="stylesheet" type="text/css" />
    <style>
        .ckall
        {
            display: block;
            height: 21px;
            padding-top: 9px;
            cursor: pointer;
        }
        #apDiv1
        {
            width: 360px;
            height: 278px;
            border: 2px solid #CCCCCC;
            background-color: #FFFFFF;
            display: inline;
        }
        .tu_title
        {
            text-align: center;
            background-color: #f1f1f1;
            font-weight: bold;
        }
        .tu_content
        {
            height: 255px;
            text-align: center;
            line-height: 255px;
        }
        .tu_content img
        {
            padding: 2px;
            border: 1px solid #CCCCCC;
            margin-top: 6%;
        }
        .index_bk_01
        {
            border: 1px solid #CCCCCC;
            height: 22px;
            line-height: 22px;
            width: 150px;
        }
        .redc
        {
            color: Red;
        }
    </style>
</head>

<script src="../js/public.js" type="text/javascript"></script>

<script src="../js/modalpopup.js" type="text/javascript"></script>

<body>
    <form id="form1" runat="server">
    <div class="ManagerForm">
        <fieldset>
            <legend style="background: url(../images/icons/icon10.jpg) no-repeat 6px 50%;">采集关键字配置</legend>
            <div class="MainDiv">
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td height="40px;">
                            &nbsp; 所属分类:
                            <select id="f_mululist0" runat="server" onchange="showifr(this.value);" style="width: 150px;">
                            </select>
                            <label for="sh_2" style="padding: 0px; margin: 0px;">
                                <input type="checkbox" name="checkbox" runat="server" onclick="showurl();" id="sh_2">采集时间远到近排序</label>
                        </td>
                        <td width="400">
                            <input name="textfield" type="text" id="textfield" runat="server" class="index_bk_01">
                            <input name="button" type="button" class="index_bk_01" id="button" value="搜  索" onclick="showurl();"
                                style="background-color: White;">
                        </td>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>

                    <script type="text/javascript">
                        function showifr(mid) {
                            showurl();

                            //hbctl_.$("ifr").src="NewsList2.aspx?mid="+mid+"&k="+hbctl_.GetRound();
                        }
                        function showurl() {
                            var mid_ = hbctl_.GetValueOrTextBySelectID("f_mululist0", "value");

                            var tf_key = hbctl_.$("textfield").value; //推荐
                            var tf_time = hbctl_.$("sh_2").checked; //按访问排行

                            var url = "default.aspx?mid=" + mid_ + "&k=" + hbctl_.GetRound();
                            if (tf_key.length > 0 && tf_key != " ") {
                                url = url + "&tf_key=" + encodeURI(tf_key);
                            }
                            if (tf_time) {
                                url = url + "&tf_time=1";
                            }

                            window.location = url;
                        }
                        function showm(mid) {
                            hbctl_.SetValueByID("f_mululist0", mid);
                            showurl();
                        }
                    </script>

                </table>
                <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#EAE9E1">
                    <tr bgcolor="#F2F2F2">
                        <td height="2" colspan="11" bgcolor="#CCCCCC">
                        </td>
                    </tr>
                    <tr bgcolor="#F2F2F2">
                        <td width="150" height="35">
                            <strong>&nbsp;名称</strong>
                        </td>
                        <td align="center">
                            <strong>关键字</strong>
                        </td>
                        <td width="100" align="center">
                            <strong>已采集数量</strong>
                        </td>
                        <td width="120" align="center" bgcolor="#F2F2F2">
                            <strong>添加日期</strong>
                        </td>
                        <td width="120" align="center" bgcolor="#F2F2F2">
                            <strong>最后采集</strong>
                        </td>
                        <td width="120" align="center" bgcolor="#F2F2F2">
                            <strong>开始采集</strong>
                        </td>
                        <td width="80" align="center" bgcolor="#F2F2F2">
                            <strong>保存</strong>
                        </td>
                        <td width="70" align="center">
                            <strong>管理操作</strong>
                        </td>
                    </tr>
                    <asp:Repeater ID="Repeater1" runat="server">
                        <ItemTemplate>
                            <tr>
                                <td bgcolor="#FFFFFF" height="35">
                                    &nbsp;<a href="javascript:showm(<%#Eval("KW_MuLuID") %>)">[<%#GetMuLuName(Eval("KW_MuLuID"))%>]</a><a
                                        href="javascript:edit(<%#Eval("KW_ID") %>)"><%#Eval("KW_Name").ToString().Length > 30 ? Eval("KW_Name").ToString().Substring(0, 28) + "..." : Eval("KW_Name")%></a>
                                </td>
                                <td bgcolor="#FFFFFF" align="center">
                                    <input name="textfield" type="text" id="keyword_<%#Eval("KW_ID") %>" value="<%#Eval("KW_WordList")%>"
                                        style="width: 250px;" class="txt" onfocus="this.className='txt_focus';" onblur="this.className='txt';">
                                </td>
                                <td align="center" bgcolor="#FFFFFF">
                                    <a href="javascript:showlist(<%#Eval("KW_ID") %>)">
                                        <%#GetCount(Eval("KW_ID"))%></a>
                                </td>
                                <td align="center" bgcolor="#FFFFFF">
                                    <%#Eval("KW_AddTime")%>
                                </td>
                                <td align="center" bgcolor="#FFFFFF" class="redc">
                                    <%#rtime(Eval("KW_LastAddDataTime"))%>
                                </td>
                                <td align="center" bgcolor="#FFFFFF">
                                    <button type="button" class="ManagerButton" id="Button2" onclick="showwin(<%#Eval("KW_ID") %>)">
                                        <img src="../images/top_level_ico2.gif" />开始采集</button>
                                </td>
                                <td align="center" bgcolor="#FFFFFF">
                                    <button type="button" class="ManagerButton" id="Button5" onclick="updata(<%#Eval("KW_ID") %>)">
                                        <img src="../images/state2.gif" />保存</button>
                                </td>
                                <td align="center" bgcolor="#FFFFFF">
                                    <a href="javascript:edit(<%#Eval("KW_ID") %>)">
                                        <img alt="编辑此信息" src="../images/icon_edit.gif" /></a> &nbsp;&nbsp;&nbsp; <a href="javascript:del_date(<%#Eval("KW_ID") %>)">
                                            <img alt="删除此信息" src="../images/icon_del.gif" /></a>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </table>
                <br />

                <script type="text/javascript">
                    var id_ = 0;

                    function rselect() {
                        hbctl_.$("f_lenxing").selectedIndex = 0;
                        hbctl_.SetValueByID("f_name", "");
                        hbctl_.SetValueByID("f_linkurl", "");
                        hbctl_.SetValueByID("f_shuoming", "");
                    }

                    function showwin(myid) {
                        var url = "show.aspx?id=" + myid;
                        window.open(url);
                    }
                    function showlist(myid) {
                        var url = "list.aspx?mid=" + myid + "&k=" + hbctl_.GetRound();
                        window.location = url;
                    }

                    function edit(myid) {
                        id_ = myid;
                        Forum.Web.Admin.KeyWord.Default.GetModel(myid, function(res) {
                            if (res && res.value) {
                                var model = res.value;

                                rselect();
                                hbctl_.SetValueByID("f_lenxing", model.KW_MuLuID);
                                hbctl_.SetValueByID("f_name", model.KW_Name);
                                hbctl_.SetValueByID("f_linkurl", model.KW_WordList);
                                hbctl_.SetValueByID("f_shuoming", model.KW_Description);

                                BOX_show("neworedit");

                                model = null;
                                delete model;
                            }
                        });
                    }
                    function onsub__() {
                        var mid_ = hbctl_.GetValueOrTextBySelectID("f_lenxing", "value");
                        var name_ = hbctl_.GetValueByID("f_name");
                        var keyword_ = hbctl_.GetValueByID("f_linkurl");
                        var sm_ = hbctl_.GetValueByID("f_shuoming");

                        if (name_.length < 1) {
                            alert("请输入名称");
                            return false;
                        }

                        if (keyword_.length < 1) {
                            alert("请输入关键字");
                            return false;
                        }

                        Forum.Web.Admin.KeyWord.Default.EditKeyWrod(id_, mid_, name_, keyword_, sm_, function(res) {
                            if (res && res.value) {
                                if (res.value == 1) {
                                    //alert("添加成功");
                                    window.location = "default.aspx?k=" + hbctl_.GetRound();
                                }
                                else if (res.value == 2) {
                                    //alert("修改成功");
                                    window.location.reload();
                                }
                            }
                        });
                    }
                    function del_date(myid) {
                        var tf_tf = window.confirm('您确定要删除选择的信息?');
                        if (tf_tf) {
                            Forum.Web.Admin.KeyWord.Default.Del(myid, function(res) {
                                if (res && res.value) {
                                    if (res.value == 1) {
                                        //alert("操作成功");
                                        window.location.reload();
                                    }
                                }
                            });
                        }
                    }
                    function updata(myid) {
                        var keyword_ = hbctl_.GetValueByID("keyword_" + myid);
                        Forum.Web.Admin.KeyWord.Default.UpDate(myid, keyword_, function(res) {
                            if (res && res.value) {
                                alert("操作成功");
                                //window.location.reload();
                            }
                        });
                    }
                </script>

                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td height="30" align="right">
                            <asp:Label ID="Label1" runat="server"></asp:Label>
                        </td>
                    </tr>
                </table>
        </fieldset>
        <div class="Navbutton">
            <cc1:Button ID="Button1" runat="server" ButtonImgUrl="../images/add.gif" Text="添加采集关键字"
                AutoPostBack="False" ScriptContent="BOX_show('neworedit')" />
        </div>
    </div>
    <div id="neworedit" style="border-right: #999 1px solid; padding-right: 10px; border-top: #999 1px solid;
        display: none; padding-left: 10px; background: #fff; padding-bottom: 10px; border-left: #999 1px solid;
        width: 500px; padding-top: 10px; border-bottom: #999 1px solid">
        <div class="ManagerForm">
            <fieldset>
                <legend style="background: url(../images/icons/icon4.jpg) no-repeat 6px 50%">配置采集关键字</legend>
                <div>
                    <table width="417" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td width="80" height="35">
                                名称:
                            </td>
                            <td>
                                <cc1:TextBox ID="f_name" runat="server"></cc1:TextBox>
                                (必填)
                            </td>
                        </tr>
                        <tr>
                            <td height="35">
                                采集到:
                            </td>
                            <td>
                                <select name="select" id="f_lenxing" runat="server">
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td height="35">
                                关键字:
                            </td>
                            <td>
                                <cc1:TextBox ID="f_linkurl" runat="server" Width="295px"></cc1:TextBox>(必填)
                            </td>
                        </tr>
                        <tr>
                            <td height="35">
                                说明:
                            </td>
                            <td>
                                <cc1:TextBox ID="f_shuoming" runat="server" Width="295px"></cc1:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                <cc1:Button ID="Button3" runat="server" ButtonImgUrl="../images/add.gif" Text=" 提 交"
                                    AutoPostBack="False" ScriptContent="onsub__()" />
                                <cc1:Button ID="Button4" runat="server" ButtonImgUrl="../images/del.gif" Text=" 取 消"
                                    AutoPostBack="False" ScriptContent="rselect();BOX_remove('neworedit');" />
                            </td>
                        </tr>
                    </table>
                </div>
            </fieldset>
        </div>
    </div>
    </form>
</body>
</html>
